package rapier.sso.core.config.mybatis;

import java.util.Date;

import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;

/**
 * Title: <br>
 * Desc: <br>
 * Date: 2020-07-11 10:46 <br>
 * Company: 联通（辽宁）产业互联网有限公司 <br>
 *
 * @author zxd
 * @version 1.0.0
 */
@Component
class MyMetaObjectHandler implements MetaObjectHandler {

	@Override
	public void insertFill(MetaObject metaObject) {
		Date now = new Date();
		setFieldValByName("createTime", now, metaObject);
		setFieldValByName("updateTime", now, metaObject);
	}

	@Override
	public void updateFill(MetaObject metaObject) {
		Date now = new Date();
		setFieldValByName("updateTime", now, metaObject);
	}
}